home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / StrategyMap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  1.1 KB  |  51 lines

  1. #ifndef _RTS_STRATEGYMAP_
  2. #define _RTS_STRATEGYMAP_
  3.  
  4. #include <vector>
  5. #include <set>
  6. #include "terrain.h"
  7. #include "player.h"
  8. #include "mapobject.h"
  9. #include "intpoint.h"
  10.  
  11. //Area status
  12. #define STATUS_UNKNOWN 0
  13. #define STATUS_FRIENDLY 1
  14. #define STATUS_ENEMY 2
  15. #define STATUS_CONFLICT 3
  16.  
  17. struct AREA
  18. {
  19.     AREA(RECT mArea);                            
  20.     void Update(TERRAIN *terrain, int teamNo);            //Update area information
  21.     bool Connected(TERRAIN *terrain, INTPOINT from);    //Is "from" connected with the area
  22.     INTPOINT GetCenter();                                //returns the center of the area
  23.     
  24.     RECT m_mapArea;
  25.     int m_status;            //Owner, conflict etc...
  26.     int m_enemyPresence;
  27.     int m_friendlyPresence;
  28.     int m_value;            //Resources, strategic value etc
  29. };
  30.  
  31. class STRATEGY_MAP
  32. {
  33.     public:
  34.         STRATEGY_MAP(TERRAIN *_terrain, PLAYER *_player, INTPOINT numAreas);
  35.         ~STRATEGY_MAP();
  36.  
  37.         void Update(std::set<MAPOBJECT*> &enemies);
  38.  
  39.         AREA* GetScoutArea(INTPOINT from);
  40.         AREA* GetAttackArea(INTPOINT from);
  41.         AREA* GetRandomArea();
  42.  
  43.     private:
  44.         TERRAIN *m_pTerrain;
  45.         PLAYER *m_pPlayer;
  46.         INTPOINT m_size;
  47.         int *m_pInfluenceMap;
  48.         std::vector<AREA> m_areas;        
  49. };
  50.  
  51. #endif